<%@ Page AutoEventWireup="false" CodeFile="SpendingPlanDownload.aspx.vb" Inherits="Budget_SpendingPlanDownload" Language="VB" MasterPageFile="~/MasterPageExpandable.master" Title="Download Spending Plan"%>
<%@ Register Assembly="InputControls" Namespace="InputControls" TagPrefix="cc1" %>

<%@ Register Src="~/Budget/BudgetSubNav.ascx" TagName="SubNavPlaceHolder" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  <script language="javascript">
 
 //If user selects a blank spending plan, auto-select
 //New date range and disable the effective date range
 // dropdown
 function spendingPlanSelect(spDropDownName,dateRangeDropDownName, dateRangePanelName)
 {
 //
 
 var spDropDown=document.getElementById(spDropDownName);
 var dateRangeDropDown=document.getElementById(dateRangeDropDownName);
 if (spDropDown.options[spDropDown.selectedIndex].value==0)
       {
            dateRangeDropDown.selectedIndex=1;
            dateRangeDropDown.disabled=true;
       }
 else
       {
           dateRangeDropDown.disabled=false;
       }
  
  effectiveDateSelect(dateRangeDropDownName, dateRangePanelName);     
  
 } 
 
 function setDefaults(checkboxObject, budgetDropDownName, dateRangeDropDownName, dateRangePanelName)
 {
    budgetDropDown=document.getElementById(budgetDropDownName);
    dateRangeDropDown=document.getElementById(dateRangeDropDownName);
   //alert(checkboxObject.checked);
    
    if (!(checkboxObject.checked))
    {
        if (budgetDropDown.options[0].value=='0')
             budgetDropDown.remove(0);
                              
        budgetDropDown.disabled=false;
       // dateRangeDropDown.disabled=false;
    }
    else
    {
         if (budgetDropDown.options[0].value!='0')
         {
            var optn = document.createElement("OPTION");
            optn.text = 'None';
            optn.value = '0';
            //alert('abc');
            budgetDropDown.options.add(optn, 0);
            budgetDropDown.selectedIndex=0;
            //alert('def');
          }
     
        budgetDropDown.disabled=true;
        dateRangeDropDown.selectedIndex=1;
        //dateRangeDropDown.disabled=true;
    }
      
      effectiveDateSelect(dateRangeDropDownName,dateRangePanelName);   
      
 }
 
 function effectiveDateSelect(dateRangeDropDownName, dateRangePanelName)
 {  
     var dateRangeDropDown=document.getElementById(dateRangeDropDownName);
   var effectiveDateDiv=document.getElementById(dateRangePanelName);
  

   var disableString="";
  
   
   if (dateRangeDropDown.selectedIndex==0)
            effectiveDateDiv.disabled=true;
   else
            effectiveDateDiv.disabled=false;
            
   //if (dateRangeDropDown.selectedIndex==0)
   //   disableString="disabled";
      
   //   effectiveDateDiv.disabled=disableString;
 }
 
 function hideErrorDisplay(errorSummaryPanel, confirmButtonsPanel)
 {
    var errorSummaryDiv=document.getElementById(errorSummaryPanel);
    var confirmDiv=document.getElementById(confirmButtonsPanel);
    errorSummaryDiv.style.display="none";
    confirmDiv.style.display="none";
   return true;
 }
 
 
 </script>
  
    <cc1:EditCaseSubNav ID="EditCaseSubNav" runat="server" InvalidTabs="none" ShowCaseNotes="True" ShowEmployeeInfo="True" ShowLegalGuardianInfo="True" ShowMedicalCareProvider="True" ShowParticipantRepInfo="True" ShowPersonalInfo="True" UseTable="true" Width="862px" />
        <cc1:FinancialSubNav  ID="FinancialSubName" runat="server" InvalidTabs="none" ShowBudgetInfo="True" ShowSubmitSpendingPlan="True" ShowViewSpendingPlan="True" ShowGetSpendingPlan="True" ShowViewMonthlyStatement="True" ShowSubmitMonthlyStatement="True" ShowGetMonthlyStatement="True" ShowHistory="True" ShowAffirmations="true" UseTable="true" Width="862px" style="left: 229px; top: 16px" />
    <asp:ObjectDataSource ID="SpendingPlansObjectDataSource" runat="server" DataObjectTypeName="Cdm.DataCore.Budget.SpendingPlanGrid" SelectMethod="ListByParticipant" TypeName="Cdm.DataCore.Budget.SpendingPlanGrid">
        <SelectParameters>
            <asp:SessionParameter SessionField="ParticipantId" Name="Id"  Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <div style="position:relative; left:11px; top:0px; width:918px; height:380px;" runat="server" id="maindiv">
        <asp:Label ID="ResultLabel" runat="server" ForeColor="Red" style="position:relative; left:0px; top:0px; 
            font-family:MS Sans Serif, Arial, Verdana, Sans-Serif; font-size: 1em; font-weight:bold;" Visible="False"></asp:Label>
        <span style="position:relative; left:9px; top:20px; 
            font-family:MS Sans Serif, Arial, Verdana, Sans-Serif; font-size: 1em; font-weight:bold; color:#21334B;">
            <h1><a id="pagecontent">Download <asp:Label runat="server" ID="SpendingPlanLabel" /> for <asp:Label runat="server" ID="ParticipantNameLabel" /></a></h1>
        </span>

        <div style="position:relative; left:70px; top:20px; background-color: #ffffff; width:875px; height:300px; overflow:auto;" runat="server" id="pageDiv">
            <table border="0"><tr><td></td>
            <td width="100%" class="labelSmallNoWidthOrAlign" align="right" style="text-align:right;"><a href="Codes.aspx">View List Service and Item Codes</a>
            </td>
            </tr>
            <tr><td colspan="2">
               <asp:Panel ID="ErrorSummaryPanel" runat="server" Visible="false">
                <cc1:ValidationErrorSummary ID="ErrorSummaryDisplay" runat="server" Text="eee"
                    Visible="False" />
               </asp:Panel>
            </td></tr>
            <tr><td><asp:Panel ID="UploadConfirmPanel" runat="server" Visible="false">
        <asp:Button ID="ConfirmDownloadButton" runat="server" Text="Confirm" />
        <asp:Button ID="CanceldownloadButton" runat="server" Text="Cancel" /></asp:Panel></td></tr>
            <tr>
            <td><asp:Label ID="SpendingPlanTwoLabel" runat="server" CssClass="label" Text="Available Spending Plans:" AssociatedControlID="SpendingPlansDropDownList"></asp:Label>
            </td><td><asp:DropDownList AppendDataBoundItems="true" ID="SpendingPlansDropDownList" runat="server" CssClass="formSelectNoWidth" DataSourceID="SpendingPlansObjectDataSource" DataTextField="EffectiveDates" DataValueField="SpendingPlanID">
                <asp:ListItem Text="Blank" Value="0" Selected="true" Enabled="true"/>
            </asp:DropDownList></td></tr>
            <tr><td><asp:Label ID="UseBudgetLabel" runat="server" CssClass="label" Text="Use Budget:" AssociatedControlID="BudgetsDropDownList"></asp:Label></td>
                <td><asp:DropDownList ID="BudgetsDropDownList" runat="server" CssClass="formSelectNoWidth" DataTextField="BudgetDescription" DataValueField="BudgetId" AutoPostBack="true">
            </asp:DropDownList></td></tr>
            <tr runat="server" id="tdCheckBox" visible="false">
                <td></td><td>
                    <asp:CheckBox ID="AllowBudgetEntryCheckBox" Checked="false" runat="server" Text="Let Me Enter Budget on Spreadsheet" CssClass="formNoWidth" />
                </td>
            </tr>
            <tr><td>
                     <asp:Label ID="EffectiveDateRangeLabel" runat="server" CssClass="label" Text="Effective Date Range:" AssociatedControlID="DateRangeDropDownList"></asp:Label></td>
                <td><asp:DropDownList ID="DateRangeDropDownList" runat="server" CssClass="formSelectNoWidth" Enabled="false">
                <asp:ListItem Text="Same Date Range as Existing" Value="0"></asp:ListItem>
                <asp:ListItem Text="New Date Range" Value="1" Selected="true"></asp:ListItem>
            </asp:DropDownList></td></tr>
            <tr><td> <asp:Label ID="EffectiveDatesLabel" runat="server" CssClass="label" Font-Bold="true" Text="Effective Dates:*" AssociatedControlID="StartDateInputControl" ></asp:Label></td><td>
            <asp:Panel ID="effectiveDatePanel" runat="server" Enabled="true">
            <table cellspacing="1" border="0"><tr valign="middle"><td ><cc1:GenericInputControl runat="server" ID="StartDateInputControl" cssClassControl="Form" cssClassLabel="label" Editable="true" ControlType="Date" Title="" /></td><td class="labelNoWidth" style="width:10px; vertical-align:bottom;">to</td><td><cc1:GenericInputControl runat="server" ID="EndDateInputControl" cssClassControl="Form" cssClassLabel="label" ControlType="Date" Title="" />
             </td></tr></table></asp:Panel>
            </td></tr>
            <tr><td></td><td><asp:Button ID="DownloadButton" runat="server" Text="Download"/></td></tr>
            <tr id="downloadlinkRow" runat="server" visible="false"><td colspan="2" align="center"><asp:Literal ID="HyperLinkLiteral" runat="server"></asp:Literal></td></tr>
            </table>
        </div>
    </div>
</asp:Content>
